﻿using System.Configuration;

namespace ERP.Framework.Components.ConfigurationHelper.CustomSettings
{
    /// <summary>
    /// Represent ConfigurationSettings section in config file
    /// </summary>
    public sealed class ConfigurationSettings : ConfigurationSection
    {
        #region Properties

        /// <summary>
        /// Gets the settings.
        /// </summary>
        /// <value>The settings.</value>
        internal static ConfigurationSettings Settings
        {
            get
            {
                return System.Configuration.ConfigurationManager.GetSection("ConfigurationSettings") as ConfigurationSettings;
            }
        }

        /// <summary>
        /// Gets a value indicating whether [use external config file].
        /// </summary>
        /// <value>
        /// 	<c>true</c> if [use external config file]; otherwise, <c>false</c>.
        /// </value>
        [ConfigurationProperty("UseExternalConfigFile", DefaultValue = "false", IsRequired = true)]
        public bool UseExternalConfigFile
        {
            get
            {
                return bool.Parse(this["UseExternalConfigFile"].ToString());
            }
        }

        /// <summary>
        /// Gets the external configuration file path.
        /// </summary>
        /// <value>The external configuration file path.</value>
        [ConfigurationProperty("ExternalConfigurationFilePath", DefaultValue = "", IsRequired = true)]
        public string ExternalConfigurationFilePath
        {
            get
            {
                return this["ExternalConfigurationFilePath"] as string;
            }
        }

        #endregion
    }
}
